<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./js/react.min.js"></script>
  <script src="./js/react-dom.min.js"></script>
  <script src="./js/babel.js"></script>
</head>
<body>
  <div id="example1"></div>
  <div id="example2"></div>
  <script type="text/babel">
      class MyComponent1 extends React.Component {
        render() {
          console.log(this.props);
          return (
            <ul>
                <li>姓名:  {this.props.username}</li>  
                <li>年龄:  {this.props.age}</li>  
                <li>性别:  {this.props.sex}</li>  
            </ul>
          )
        }
      }
      let Person = {
        username: '张三',
        age: 34,
        sex: '男'
      }
      // 用标签属性的形式传递参数
      // ReactDOM.render(<MyComponent1 username={Person.username} age={Person.age} sex={Person.sex}/>, document.getElementById('example1'))
      // 用对象的扩展属性将所有属性传递
      ReactDOM.render(<MyComponent1 {...Person}/>, document.getElementById('example1'))
  </script>
</body>
</html>